package edu.indiana.d2i.ontology;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;

import edu.indiana.d2i.ontology.exec.Forest;
import edu.indiana.d2i.ontology.util.AccessDBUtil;

@SuppressWarnings("unused")
public class Converter {
	private String datasource;
	private String rdfFileName;
	
	/* these two variables are shared by subclasses of AbstractSQLExec */
	private AccessDBUtil dbCon = null;
	private Model model = null;
	
	protected List<AbstractSQLExec> generateSqlExecs() {
		ArrayList<AbstractSQLExec> statements = new ArrayList<AbstractSQLExec>();
		
		// a boring list starts blow
//		String sql = "";
		int id = 1;
//		statements.add(new Forest(dbCon, model, id));
		
		return statements;
	}
	
	public Converter(String datasource, String rdfFileName) {
		this.datasource = datasource;
		this.rdfFileName = rdfFileName;
		this.dbCon = new AccessDBUtil(datasource, "", "");
		this.model = ModelFactory.createDefaultModel();
	}
	
	public void convert() {
		// make up SQL statement
		List<AbstractSQLExec> sqlExecs = generateSqlExecs();
		
		// fetch data
		dbCon.openConnection();
		for (AbstractSQLExec sql : sqlExecs) {
			sql.setData2JenaModel();
		}
		dbCon.closeConnection();
		
		// write to a RDF/XML file
		model.write(System.out);
	}
	
	public static void main(String[] args) {
		
	}
}
